<?php


$client = new swoole_client(SWOOLE_SOCK_TCP);

//连接到服务器
if(!$client->connect('127.0.0.1',9501)){
	echo "链接失败";
	exit;
}

//输入数据
fwrite(STDOUT, "请输入消息");
$msg = trim(fgets(STDIN));


//向服务器发送数据
if(!$client->send($msg)){
	die("发送失败");
}

$result = $client->recv();
echo $result;
